﻿Public Class frmReporteFacturasEliminadas
    Private fechaInicial As DateTime
    Private fechaFinal As DateTime
    Private nitC As String

    Private Sub txtNit_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNit.KeyPress
        If txtNit.TextLength = 0 And e.KeyChar = "c" Or e.KeyChar = "C" Then
            txtNit.Text = "CF"


        End If
        'verificamos que se ingresen letras o numeros
        If txtNit.TextLength >= 8 Then 'la ultima posicion del nit puede ser letra 
            If (Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or e.KeyChar >= "a" And e.KeyChar <= "z" Or e.KeyChar >= "A" And e.KeyChar <= "Z" Or e.KeyChar = vbBack Or e.KeyChar = " ")) Then
                e.KeyChar = vbNullChar

            End If
        Else

            If (Not (e.KeyChar >= "0" And e.KeyChar <= "9" Or e.KeyChar = vbBack Or e.KeyChar = " ")) Then
                e.KeyChar = vbNullChar

            End If
        End If
    End Sub

    Private Sub dtpInicio_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpInicio.MouseLeave
        '' slblDescripcion.Text = "Descripción"
    End Sub

    Private Sub dtpFin_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpFin.MouseLeave
        ''slblDescripcion.Text = "Descripción"
    End Sub

    Private Sub txtNit_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtNit.MouseLeave
        '' slblDescripcion.Text = "Descripción"
    End Sub

    Private Sub btnCancelar_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancelar.MouseLeave
        '' slblDescripcion.Text = "Descripción"
    End Sub

    Private Sub btnAceptar_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAceptar.MouseLeave
        ''slblDescripcion.Text = "Descripción"
    End Sub

    Private Sub rptvReporte_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs)
        '' slblDescripcion.Text = "Descripción"
    End Sub

    Private Sub chFecha_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs)
        ''slblDescripcion.Text = "Descripción"
    End Sub

    Private Sub chNit_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs)
        ''slblDescripcion.Text = "Descripción"
    End Sub

    Private Sub chFecha_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs)
        ''slblDescripcion.Text = "Opción para habilitar la busqueda de facturas eliminadas por fecha"
    End Sub

    Private Sub chNit_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs)
        ''slblDescripcion.Text = "Opción para habilitar la busqueda de facturas eliminadas por cliente"
    End Sub

    Private Sub dtpInicio_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpInicio.MouseHover
        '' slblDescripcion.Text = "Seleccióne la fecha de inicio para la busqueda"
    End Sub

    Private Sub dtpFin_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpFin.MouseHover
        '' slblDescripcion.Text = "Seleccióne la fecha de fin para la busqueda"
    End Sub

    Private Sub txtNit_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtNit.MouseHover
        ''slblDescripcion.Text = "Ingrese el nit del cliente a buscar"
    End Sub

    Private Sub btnCancelar_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancelar.MouseHover
        ''slblDescripcion.Text = "Sale del reporte actual"
    End Sub

    Private Sub btnAceptar_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAceptar.MouseHover
        '' slblDescripcion.Text = "Muestra el reporte requerido"
    End Sub

    Private Sub rptvReporte_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs)
        ''slblDescripcion.Text = "Reporte de las facturas eliminadas"
    End Sub

    Private Sub btnCancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancelar.Click
        Me.Dispose()
    End Sub

    Private Sub frmReporteFacturasEliminadas_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAceptar.Click
        fechaInicial = dtpInicio.Text
        fechaFinal = dtpFin.Text
        nitC = txtNit.Text
        Dim rpt As New rptFacturasEliminadasFyN   ' se instancia un objeto del reporte
        Dim consulta As New dsReportesTableAdapters.facturasEliminadasFechaNitTableAdapter  ' se instancia el tableAdapter (este es la conexión a la BD)
        Dim ds As New dsReportes ' el dataset se debe llenar, para colocarlo como fuente del reporte
        consulta.Fill(ds.facturasEliminadasFechaNit, fechaInicial, fechaFinal, nitC) ' se llena la dataTable de proveedores, q en si será la fuente del reporte
        rpt.SetDataSource(ds) ' se coloca como fuente del reporte
        crvReporte.ReportSource = rpt ' el reporte es fuente del crystal report viewer
    End Sub
End Class